/*
 * @Date: 2023-04-30 18:31:07
 * @LastEditTime: 2023-06-23 11:21:17
 * 介绍:
 */
import RpopupPicker from "./RpopupPicker.vue";
/**获取pickerRef实例 */
export function useRpopupPickerRef<D>() {
  //@ts-ignore
  // type Instance = Omit<InstanceType<typeof RpopupPicker>, "elect">;
  type Instance = GenericComponentExports<typeof RpopupPicker>;
  return ref<
    Omit<Instance, "elect" | "resetElect"> & {
      elect: (D & { value: number }) | undefined;
      resetElect: (callBack?: VerifyFunction<D>) => Promise<void>;
    }
  >();
}

export interface VerifyFunction<D> {
  (value: D, index: number): boolean | Promise<boolean> | void;
}
